package com.sbm.merge.generic;

import java.util.List;

public class PrintService<T extends Car> {

    private T content;

    private List<T> contents;

    public PrintService(T c){
        this.content = c;
    }

    public void print(){

        for (T o : contents) {
            o.getName();
        }

    }

    /**
     *  super 只能用于在方法的参数类型中限制
     *   限制类型只能是 T，或者是T的超类型
     */
    public   void add(T c){
        contents.add(c);
    }


}
